package swta.hellolift.model

import _root_.net.liftweb.mapper._
import _root_.net.liftweb.util._
import _root_.net.liftweb.sitemap._
import _root_.net.liftweb.sitemap.Loc._

object Entry extends Entry with KeyedMetaMapper[Long, Entry] {
  override def dbTableName = "entries"
  
  // sitemap entry
  val sitemap = List(Menu(Loc("CreateEntry", List("entry"), "Create An Entry")),
		     Menu(Loc("ViewEntry", List("view"), "View An Entry", Hidden)),
		     Menu(Loc("ViewBlog", List("blog"), "View Blog")))
}

class Entry extends KeyedMapper[Long, Entry] {
  def getSingleton = Entry
  def primaryKeyField = id

  object id extends MappedLongIndex(this)
  object title extends MappedString(this, 128)
  object body extends MappedTextarea(this, 20000) {
    override def setFilter = notNull _  :: trim _ :: crop _ :: super.setFilter
  }
}